﻿using System.Text.RegularExpressions;

namespace CalcSharp.Core.General
{
    public static class Patterns
    {
        public const string Float = @"^\$[a-z1-9_-]+";

        public const string FloatArray = @"^\$[a-z1-9_-]+(\[\])$";

        public const string FloatArrayIndexer = @"^\$[a-z1-9_-]+(\[\d+\])$";

        public const string Complex = @"^\&[a-z1-9_-]+";

        public const string ComplexArray = @"^\&[a-z1-9_-]+(\[\])$";

        public const string ComplexArrayIndexer = @"^\&[a-z1-9_-]+(\[\d+\;\d+\])$";

        public const string String = @"^\~[a-z1-9_-]+";

        public const string Matrix = @"^\#[a-z1-9_-]+";

        public const string MatrixIndexer = @"^\#[a-z1-9_-]+(\[\d+\;\d+\])$";

        public static bool Match(string input, string pattern)
        {
            return Regex.Match(input, pattern).Success;
        }
    }
}
